<!DOCTYPE html>
<html lang="en" dir="ltr">
    <head>
        <meta charset="utf-8">
        <title>模拟轮询</title>
    </head>
    <body>
        <span>模拟轮询</span>
    </body>
</html>
<script type="text/javascript" src="//cdn.staticfile.org/jquery/3.6.0/jquery.min.js?date=1"></script>
<script type="text/javascript">
    var socket_url = "ws://127.0.0.1:2345/";
    socket_url = "wss://i.fe80.cn/workerman";
    ws = new WebSocket(socket_url);
    ws.onopen = function() {

    };
    ws.onmessage = function(e) {
        var _data = JSON.parse(e.data);
        console.log(_data);
        $('body').append('<p>已接收：' + _data.time + '</p>');
    };
    ws.onclose = function(){

    };
    setTimeout(function(){
        ws.send(JSON.stringify({'bind_time':'test'}));
    },500);
</script>
